﻿using System;
using System.Data;
using System.Data.OleDb;
using System.Collections.Generic;

using RexToy.ORM;

namespace Studio.Model
{
    class OleDbModel : DatabaseModel
    {
        public OleDbModel()
        {
            _server = "c:\\test.mdb";
            _username = "Admin";
            _password = "";
        }

        public override string ConnectString
        {
            get { return string.Format("Provider=Microsoft.Jet.OLEDB.4.0;User ID={0};Data Source={1};Mode=Share Deny None;", UserName, Server); }
        }

        public override string Dialect
        {
            get { return RexToy.ORM.Session.Dialect.OLEDB; }
        }

        public override string Provider
        {
            get { return null; }
        }

        public override string DialectProvider
        {
            get { return null; }
        }

        public override void ReadModel()
        {
            using (var db = DatabaseFactory.OpenDatabase())
            {
                _tables = db.QueryMeta().Tables;
            }
        }
    }
}
